Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
nuke-refresh-control
Advanced tools
RefreshControl 是一个能够实现下拉刷新的子组件,且父组件只能是 <Scrollview>
或 <ListView>
。
// 完整 demo 请参考 ScrollView 组件的 Demo
//初始 state
constructor() {
super();
this.state={
isRefreshing: false,
refreshText: '↓ 下拉刷新',
data:[
//...省略部分代码
]
}
}
handleRefresh =()=>{
this.setState({
isRefreshing: true,
refreshText: '加载中',
});
// mock ajax 此处替换为你的 ajax 请求
setTimeout(() => {
this.setState({
isRefreshing: false,
data: [
// data 字段变更
],
refreshText: '↓ 下拉刷新',
});
}, 1000);
}
render(){
return(
<ScrollView>
<RefreshControl isRefreshing={this.state.isRefreshing} style={{width:750,height:100}} onRefresh={this.handleRefresh}>
<Text>{this.state.refreshText}</Text>
</RefreshControl>
{/* 此处为你的内容区域 */}
<ScrollView>
)
}
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
isRefreshing | 是否展示 | false | |
onRefresh | refresh 事件 | Function | |
style | 样式,必须声明宽高否则可能无法展示 | object |
FAQs
We found that nuke-refresh-control demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.